package com.CI.Login.Commands {
	
	import com.CI.Login.Business.LogDelegate;
	import com.CI.Login.Control.LoginEvents;
	import com.CI.Login.Control.LogoutEvents;
	
	import com.adobe.cairngorm.business.Responder;
	import com.adobe.cairngorm.commands.Command;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	public class LogCommands implements Command,Responder
	{	
		public function execute(event : CairngormEvent) : void
		{
			var str : String = event.type;
			
			if(str == 'loginEvent')
			{
				var loginEvent : LoginEvents = LoginEvents(event);
				getDelegate.sendObject(loginEvent.login);
			}
			else
			{
				var logoutEvent : LogoutEvents = LogoutEvents(event);
				getDelegate.sendObject(logoutEvent.logout);
			}
		
		}
		
		public function onFault(event : *=null):void
		{
			
		}
		
		public function onResult(event : *=null):void
		{
			
		}
		
		protected function get getDelegate(): LogDelegate
		{
			return new LogDelegate(this);
		}
	}
}